﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
using MySql.Data.Types;
using TAMS;

namespace TAMS.TA
{
   
    public partial class TA_Welcome : System.Web.UI.Page
    {
        MySqlConnection conn;
        MySqlCommand sqlCommand;
        MySqlDataReader readVals;
        string strProvider = Resource1.databaseConnection;
        string id;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userName"] != null)
            {
                string uname = Session["userName"].ToString();

                conn = new MySqlConnection(strProvider);
                conn.Open();

                string strSQL = "SELECT s_name FROM gradStudent " +
                                " WHERE sid = " +uname;

                sqlCommand = new MySqlCommand(strSQL, conn);
                readVals = sqlCommand.ExecuteReader();

                readVals.Read();


                Label1.Text = "<p> " +
                                "<font size=\"4\" face=\"arial\" color=\"blue\"> " +
                                "Welcome " + readVals.GetString("s_name") +
                                "</font> " +
                                "</p> ";
            }
           else
            {
                Response.Redirect("../login.aspx", false);
                Context.ApplicationInstance.CompleteRequest();
            }
        }
    }
}